<?php

namespace common\models\c2\statics;

use Yii;
use yii\helpers\ArrayHelper;

/**
 * ConfigType
 *
 * @author ben
 */
class CertificatesType extends AbstractStaticClass {

    const TYPE_ED = 11;  // load in when demand
    const TYPE_YJJLZ = 12;  // load in when demand
    const TYPE_GA = 13;  // load in when demand
    const TYPE_TW = 14;  // load in when demand
    const TYPE_PASSPORT = 15;  // load in when demand
    const TYPE_OTHER = 16;  // load in when demand

    protected static $_data;

    /**
     * 
     * @param string $id
     * @param string $attr
     * @return string|array
     */
    public static function getData($id = '', $attr = '') {
        if (is_null(static::$_data)) {
            static::$_data = [
                static::TYPE_ED => ['id' => static::TYPE_ED, 'label' => Yii::t('app.c2', 'ERDAI')],
                static::TYPE_YJJLZ => ['id' => static::TYPE_YJJLZ, 'label' => Yii::t('app.c2', 'YONGJIUJULIUZHENG')],
                static::TYPE_GA => ['id' => static::TYPE_GA, 'label' => Yii::t('app.c2', 'GANGAO')],
                static::TYPE_TW => ['id' => static::TYPE_TW, 'label' => Yii::t('app.c2', 'TAIWAN')],
                static::TYPE_PASSPORT => ['id' => static::TYPE_PASSPORT, 'label' => Yii::t('app.c2', 'PASSPORT')],
                static::TYPE_OTHER => ['id' => static::TYPE_OTHER, 'label' => Yii::t('app.c2', 'Other')],
            ];
        }
        if ($id !== '' && !empty($attr)) {
            return static::$_data[$id][$attr];
        }
        if ($id !== '' && empty($attr)) {
            return static::$_data[$id];
        }
        return static::$_data;
    }

}
